<template>
  <div>
    <mltable :config="config" :outer-btn="outerBtn" :inner-btn="innerBtn" @resetPsw="resetPsw"/>
  </div>
</template>

<script>
import mltable from '@/components/mlTable'
export default {
  components: { mltable },
  props: {},
  data() {
    return {
      config: {
        inline: true,
        table: true,
        api: 'account',
        labelWidth: '100px',
        dataList: [
          {
            type: 'date',
            label: '出生日期',
            key: 'birthday',
            showTable: true
          },
          {
            type: 'string',
            label: '电子邮箱',
            key: 'email',
            showTable: true
          },
          {
            type: 'string',
            label: '用户名',
            key: 'name',
            showTable: true
          },
          {
            type: 'string',
            label: '手机号',
            key: 'tel',
            showTable: true
          },
          {
            type: 'select',
            label: '用户类型',
            options: [
              { value: 0, label: '超级管理员' },
              { value: 1, label: '商户' }
            ],
            key: 'type',
            showTable: true,
            tableSearchDefault: null,
            sortable: 'custom'
          }
        ],
        tableKey: 'id', // 主键
        inputWidth: '33.33%'
      },
      innerBtn: [
        {
          evtType: 'resetPsw',
          icon: 'resetPsw',
          name: '重置密码',
          showJudge: { type: 1 }
        }
      ],
      outerBtn: [
        {
          evtType: 'resetPsw',
          icon: 'resetPsw',
          name: '重置密码',
          showJudge: { type: 1 },
          selection: 'multiple'
        }
      ]
    }
  },

  computed: {},

  created() {},

  mounted() {},

  activated() {},

  methods: {
    resetPsw(ids) {
      const id = []
      ids.forEach(obj => {
        id.push(obj.id)
      })
      this.$http.post('account/password/reset', id).then(res => {
        this.$message.success('重置完成')
      })
    }
  }
}
</script>

<style lang='scss' scoped>
</style>
